Socket
Socket
Sign inDemoInstall

shell-escape

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shell-escape

Escape and stringify an array of arguments to be executed on the shell


Version published
Weekly downloads
293K
increased by1.82%
Maintainers
2
Weekly downloads
 
Created

What is shell-escape?

The shell-escape npm package is used to escape and sanitize strings for use in shell commands. This is particularly useful to prevent shell injection attacks and ensure that shell commands are executed safely.

What are shell-escape's main functionalities?

Basic String Escaping

This feature allows you to escape a basic string to be safely used in a shell command. The example demonstrates escaping a simple echo command.

const shellEscape = require('shell-escape');
const command = shellEscape(['echo', 'Hello World']);
console.log(command); // Output: echo 'Hello World'

Escaping Arguments with Special Characters

This feature shows how to escape arguments that contain special characters. The example demonstrates escaping a string with an ampersand.

const shellEscape = require('shell-escape');
const command = shellEscape(['echo', 'Hello & World']);
console.log(command); // Output: echo 'Hello & World'

Escaping File Paths

This feature allows you to escape file paths that may contain spaces or other special characters. The example demonstrates escaping a file path with spaces.

const shellEscape = require('shell-escape');
const filePath = '/path/to/some file.txt';
const command = shellEscape(['cat', filePath]);
console.log(command); // Output: cat '/path/to/some file.txt'

Other packages similar to shell-escape

Keywords

FAQs

Package last updated on 11 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc